package com.doit.spark.day01

/**
 * @DATE 2022/1/2/16:56
 * @Author MDK
 * @Version 2021.2.2
 * */
object TestIterator {
  def main(args: Array[String]): Unit = {
    val iterator = new MysqlIterator("jdbc:mysql://linux01:3306/doit", "root", "root")
    //使用Scala中的集合函数 处理mysql中的数据
//    iterator.map(user=>user.name).foreach(println)
    //while
    while (iterator.hasNext){
      val user = iterator.next()
      println(user)
    }
    //增强for循环
    for (elem <- iterator) {
      println(elem)
    }
  }
}
